{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# -*- coding:utf-8 -*-\n",
    "# 删除前缀\n",
    "import pandas as pd\n",
    "# 注意：文件名前必须加'u'，要不然会报错\n",
    "inputfile1 = u'meidi_jd_process_end_负面情感结果.txt' # 评论汇总文件\n",
    "inputfile2 = u'meidi_jd_process_end_正面情感结果.txt' # 评论汇总文件\n",
    "\n",
    "\n",
    "data1 = pd.read_csv(inputfile1, encoding = 'utf-8', header = None) #(***)\n",
    "data2 = pd.read_csv(inputfile2, encoding = 'utf-8', header = None) #(***)\n",
    "\n",
    "data1 = pd.DataFrame(data1[0].str.replace('.*?\\d+?\\\\t', '')) # 使用正则表达式替换掉前缀\n",
    "data2 = pd.DataFrame(data2[0].str.replace('.*?\\d+?\\\\t', '')) # 使用正则表达式替换掉前缀\n",
    "\n",
    "data1.to_csv(u'3_1my_meidi_jd_process_end_负面情感结果.txt', header = False, index = False, encoding='utf-8') # (***)\n",
    "data2.to_csv(u'3_2my_meidi_jd_process_end_正面情感结果.txt', header = False, index = False, encoding='utf-8') # (***)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
